package ua.simplecoding.kievhome.domain;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "appartment_image")
public class AppartmentImage extends AbstractPrimaryEntity implements Serializable {

    @Basic(fetch= FetchType.EAGER)
    @Lob
    @Column(name="image_source")
    private byte[] source;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name="appartment_details_fk", referencedColumnName = "pk")
    private AppartmentDetails appartmentDetails;

    public AppartmentImage(int id) {
        super(id);
    }

    public AppartmentImage() {
    }

    public byte[] getSource() {
        return source;
    }

    public void setSource(byte[] source) {
        this.source = source;
    }

    public AppartmentDetails getAppartmentDetails() {
        return appartmentDetails;
    }

    public void setAppartmentDetails(AppartmentDetails appartmentDetails) {
        this.appartmentDetails = appartmentDetails;
    }
}
